package com.ganee.agora.repository

import com.ganee.agora.model.HomeListBean
import com.ganee.agora.model.UserInfoEntity
import com.ganee.baselib.httprequest.callback.RequestCallback
import com.ganee.baselib.httprequest.http.HttpRequest
import com.ganee.baselib.mvvmlibrary.base.BaseRepository
import com.ganee.baselib.mvvmlibrary.base.BaseViewModel
import com.ganee.agora.api.MainApiService

class MainRepository(baseViewModel: BaseViewModel<*>) : BaseRepository(baseViewModel) {

    /**
     * 请求接口
     */
    fun requestMainList(callback: RequestCallback<List<HomeListBean>>) {
        execute(HttpRequest.getInstance().creteApiService(MainApiService::class.java).postHomeList(), callback)
    }

    /**
     * 获取用户信息
     */
    fun getUserInfo(callback: RequestCallback<UserInfoEntity>) {
        executeQuietly(getApi(MainApiService::class.java).postUserInfo(), callback)
    }
}
